package com.szzg10.webservice.chapter3;

import java.util.Map;
import java.util.Set;

import javax.xml.namespace.QName;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;

public class EchoHandler implements SOAPHandler<SOAPMessageContext> {

	@Override
	public boolean handleMessage(SOAPMessageContext ctx) {
		
		Boolean response_flag = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
		if(!response_flag) {
			MapDump.dump_map((Map)ctx, "");
		}
		
		return true;
	}
	
	@Override
	public void close(MessageContext arg0) {}

	@Override
	public boolean handleFault(SOAPMessageContext arg0) {
		return true;
	}

	@Override
	public Set<QName> getHeaders() {
		return null;
	}

}
